import yaml
from os.path import dirname, join, abspath

class Init_Config:
    def __init__(self, ROBOT = False):
        if ROBOT:
        # 这里open的基路径是main.py
            with open(join(dirname(str(abspath(__file__))),'robot_init.yml'), 'r', encoding='utf-8') as f:
                init_config= yaml.load(f.read(), Loader=yaml.FullLoader)
        else:
            with open(join(dirname(str(abspath(__file__))),'init.yml'), 'r', encoding='utf-8') as f:
                init_config= yaml.load(f.read(), Loader=yaml.FullLoader)
        self.init_config = init_config
        self.joint_names = self.init_config.get('joint_names',[])
